import {NumberIdAndName} from "../types/BasicModels";
import fetcher from "../apis/Fetcher";
import {Page, Pageable} from "../utils/Page";
import {OffsetDateTime} from "@js-joda/core";

export interface QueryEmployeeOperateRecordRequest {
    operatorIds?: number[]
    createdStartDate?: string
    createdEndDate?: string
}

export function queryEmployeeOperateRecords(request:QueryEmployeeOperateRecordRequest,pageable:Pageable) {
    return fetcher.get<Page<QueryEmployeeOperateRecordResponse>>("employees/operationRecords",{
        ...request,
        ...pageable.toRequestParams(),
    })
}

export interface QueryEmployeeOperateRecordResponse {
    content: ContentItem[]
    id: number
    createdDateTime: OffsetDateTime
    createdBy: NumberIdAndName
}

export type ResourceType = keyof { [I in (typeof resourceTypes)[number]] }

export const resourceTypes = ["MarketOrder","MarketDeliveryOrder"] as const

export interface ContentItem {
    text: string
    highlight: boolean
    resource: {
        type: ResourceType,
        id: string
    }
}


